<template>
	<div class="rec-newlist pt3 pl3 pr3  bg-fff">
		<h1 class="recnews-title bg-fff">推荐新闻</h1>
		<div class="news-box mb3" v-for="(o,index) in recnews" v:bind:item="o" v-bind:index="index">
			<div v-on:click="up(o.link)">
				<h2 class="news-btitle">{{ o.title }}</h2>
				<div class="news-bimg clearfix" >
					<div class="imgso fl" v-for="(t,ind) in o.imageurls" v:bind:item="t" v-bind:index="ind" v-if="ind < 3">
						<img class="imgblock" :src="t.url">
					</div>
				</div>
				<div class="new-other  pt4 pb4 clearfix">
					<span class="newoth-source fl">来源：{{ o.source }}</span>
					<span class="newoth-time fr">时间：{{ o.pubDate }}</span>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import axios from 'axios';
	export default{
		data(){
			return{
				recnews:[]
			}
		},
		mounted: function(){
			let url = '/api/109-35';
			let sign = 'bc41dbe15d504543b791fe0cc5a80e50';
			axios({
				method: 'post',
				url: url,
				params: {
					'showapi_appid':'54164',
			    	'showapi_sign':sign,
			    	'page':'1',
			    	'maxResult':'40'
				}
			}).then((res) => {
				console.log(res.data.showapi_res_body.pagebean.contentlist)
				this.recnews = res.data.showapi_res_body.pagebean.contentlist
			})
		},
		methods:{
			up(l){
				const that = this;
				this.$emit('plink',l)
				that.$router.push("/newsdetail")
			}
		}
	}
</script>

<style scoped>
	.rec-newlist{border-top:.5rem solid #efefef}
</style>